package com.github.vortexdev.yachtclub.services;

import com.github.vortexdev.yachtclub.models.Regatta;
import com.github.vortexdev.yachtclub.models.Yacht;
import com.github.vortexdev.yachtclub.repository.RegattaRepository;

import java.util.List;

/**
 * @author Sergey Parakhin (sergey.parahin@gmail.com)
 */
public class RegattaService {
    RegattaRepository regattaRepository;

    public void setRegattaRepository(RegattaRepository regattaRepository) {
        this.regattaRepository = regattaRepository;
    }

    public List<Regatta> getRegattas() {
        return regattaRepository.findAll();
    }

    public List<Regatta> getRegattasByYacht(Yacht yacht) {
        return regattaRepository.findByYacht(yacht);
    }
}
